/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hu
 * Date: 2024-05-10
 * Time: 22:02
 */
public class Test {
    public static int find(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            int count = 0;
            int k = i;
            for (int j = 0; j < arr.length; j++) {
                if(arr[j] == arr[i] && i != j){
                    count++;
                }
            }
            if(count > (arr.length) / 2){
                System.out.print(arr[i] + " ");
            }
        }
        return 1;00
    }

    public static void main(String[] args) {
        int[] arr = {1,2,4,1,2,2,2,2,};
        find(arr);
    }
}
